﻿<gui:AbstractInlineRefactorDialog x:Class="SharpRefactoring.Gui.InsertCtorDialog"
	Header="{sd:Localize AddIns.SharpRefactoring.InsertCtor}"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:gui="clr-namespace:SharpRefactoring.Gui"
	xmlns:addin="clr-namespace:SharpRefactoring"
	xmlns:sd="http://icsharpcode.net/sharpdevelop/core"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
	<gui:AbstractInlineRefactorDialog.Resources>
		<gui:IntToBoolConverter x:Key="intToBoolConverter" />
		<Style TargetType="Button" BasedOn="{x:Static sd:GlobalStyles.ButtonStyle}"/>
	</gui:AbstractInlineRefactorDialog.Resources>
	<Grid Cursor="Arrow" KeyboardNavigation.TabNavigation="Cycle">
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto" />
			<RowDefinition Height="*" />
			<RowDefinition Height="Auto" />
		</Grid.RowDefinitions>
		<TextBlock Margin="3"
		           Text="{sd:Localize AddIns.SharpRefactoring.InsertCtor.Description}"
		           TextWrapping="Wrap" />
		<ListView x:Name="varList" Grid.Row="1"
		          SelectionMode="Multiple" KeyboardNavigation.TabNavigation="Cycle" 
		          ItemContainerStyle="{x:Static sd:GlobalStyles.ListViewItemFocusHighlightStyle}" MaxHeight="300">
			<ListView.View>
				<GridView>
					<GridViewColumn Header="{sd:Localize AddIns.SharpRefactoring.InsertCtor.VariableLabel}">
						<GridViewColumn.CellTemplate>
							<DataTemplate>
								<CheckBox Content="{Binding Text}" IsChecked="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBoxItem}},Path=IsSelected}" />
							</DataTemplate>
						</GridViewColumn.CellTemplate>
					</GridViewColumn>
					<GridViewColumn Header="{sd:Localize AddIns.SharpRefactoring.InsertCtor.AddCheckForNullLabel}">
						<GridViewColumn.CellTemplate>
							<DataTemplate>
								<CheckBox IsChecked="{Binding AddCheckForNull, Mode=TwoWay}" IsEnabled="{Binding IsNullable}" />
							</DataTemplate>
						</GridViewColumn.CellTemplate>
					</GridViewColumn>
					<GridViewColumn Header="{sd:Localize AddIns.SharpRefactoring.InsertCtor.AddRangeCheckLabel}">
						<GridViewColumn.CellTemplate>
							<DataTemplate>
								<CheckBox IsChecked="{Binding AddRangeCheck, Mode=TwoWay}" IsEnabled="{Binding HasRange}" />
							</DataTemplate>
						</GridViewColumn.CellTemplate>
					</GridViewColumn>
				</GridView>
			</ListView.View>
		</ListView>
		<DockPanel Grid.Row="2" LastChildFill="False">
			<Button DockPanel.Dock="Left" Content="{sd:Localize Global.OKButtonText}" Margin="3" Click="OKButtonClick" />
			<Button DockPanel.Dock="Left" Content="{sd:Localize Global.CancelButtonText}" Margin="3" Click="CancelButtonClick" />
			<Button x:Name="moveDown" DockPanel.Dock="Right" Content="{sd:Localize Global.MoveDown}" Margin="3" IsEnabled="{Binding SelectedIndex, ElementName=varList, Converter={StaticResource intToBoolConverter}}" Click="DownClick" />
			<Button x:Name="moveUp" DockPanel.Dock="Right" Content="{sd:Localize Global.MoveUp}" Margin="3" IsEnabled="{Binding SelectedIndex, ElementName=varList, Converter={StaticResource intToBoolConverter}}" Click="UpClick" />
			<ToggleButton x:Name="selectAll" DockPanel.Dock="Right" Content="{sd:Localize Global.SelectAllButtonText}" Margin="3" IsChecked="{Binding AllSelected, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type gui:InsertCtorDialog}}, Mode=OneWay}" Checked="SelectAllChecked" Unchecked="SelectAllUnchecked" />
		</DockPanel>
	</Grid>
</gui:AbstractInlineRefactorDialog>